<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>注册</title>
<style>
*{ margin:0 auto; padding:0; list-style:none; text-decoration:none;}
#big{ width:600px; height:800px; margin-top:100px; margin-left: 600px;}

</style>
</head>

<body background="img/11-1.jpg">
<div id="big">
<div id="d1" align="center"><h1 style="color: #4288FF">OPPO用户注册</h1></div>
    <form method="post">
<table width="600" align="center"cellspacing="25px;">
      <tr>
         <td align="right">用户名称</td>
         <td><input type="text"name="user"></td>
      </tr>
       <tr>
         <td align="right">密码:</td>
         <td><input type="password" name="password"></td>
      </tr>
      <tr>
          <td align="right">确认密码:</td>
          <td><input type="password" name="password_confirm"></td>
      </tr>
      <tr>
          <td align="right">昵称:</td>
          <td><input type="text" name="name"></td>
      </tr>
      <tr>
          <td align="right">手机号码:</td>
          <td><input type="text" name="phone"></td>
      </tr>
       <tr>
          <td align="right">邮箱:</td>
          <td><input type="text" name="tel"></td>
      </tr>
      <tr>
          <td align="right">性别:</td>
          <td>
              <input type="radio" value="男" name="sex" style=" width: 15px; height: 15px;"
                            checked><b style=" font-size: 18px; color: #4288FF;">男</b><input type="radio" style=" width: 15px; height: 15px; margin-left: 100px" value="女" name="sex"><b style=" font-size: 18px;color: #4288FF;">女</b><br>
          </td></tr>
       <tr>
            <td align="right">年龄:</td>
            <td><input type="text"></td>
        </tr>
      <tr>
           <td align="right">地区</td>
           <td>
               <select>
                    <option>江西</option>
                    <option>辽宁</option>
                    <option>上海</option>
                    <option>北京</option>
                    </select></td></tr>
      <tr>
          <td colspan="2" align="center">
                <input type="checkbox">
                <span>我已阅读并同意</span>
          </td>
      </tr>
      <tr>
          <td colspan="2" align="center">
          <input type="submit" value="下一步"name="sub"
                 style="width:200px;height:40px;
         background: #4288FF; font-size:14px; color:#FFF;">
          </td>
      </tr>
</table>
</div>
</div>


<?php
header("content-type:text/html;charset=utf-8");
if(isset($_POST['sub']))
{
    session_start();
    $user= $_POST['user'];
    $phone= $_POST['phone'];
    $name= $_POST['name'];
    $sex= $_POST['sex'];
    $password=$_POST['password'];
    $password_confirm=$_POST['password_confirm'];
    $tel=$_POST['tel'];


    $_SESSION['phone']=$phone;//传值
    $_SESSION['tel']=$tel;//传值
    $_SESSION['sex']=$sex;//传值
    if($user==""){
        echo"<script>alert('请输入用户名！')</script>";
    }else{
        $_SESSION['user']=$user;
    }
    if($name==""){
        echo"<script>alert('请输入昵称！')</script>";
    }else{
        $_SESSION['name']=$name;
    }
    if($password==""){
        echo"<script>alert('请输入密码！')</script>";
    }elseif($password_confirm==""){
        echo"<script>alert('请确定密码！')</script>";
    }elseif($password!=$password_confirm){
        echo"<script>alert('两次密码不相同！')</script>";
    }
    elseif($password==$password_confirm){
        $_SESSION['password']=$password;
    }elseif($phone==""){
        echo"<script>alert('请输入电话号码！')</script>";
    }elseif($tel==""){
        echo"<script>alert('请输入邮箱 ！')</script>";
    }
    if($user!=""&&$password!=""&&$password==$password_confirm&&$tel!=""&&$name!=""&&$phone!=""&&$tel!=""){
        header('Location:xz.php');
        echo '<script>window.close();</script>';

    }



}
?>
</body>
</html>
